package org.xdq.demo.config;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

//服务于前端控制器的配置类
@Configuration
@ComponentScan(basePackages = "org.xdq.demo.api")//扫描Controller配置
@EnableWebMvc //该注解将启用更多的mvc默认配置，包括json的转换和日期格式化等
public class MvcConfig implements WebMvcConfigurer {

    //使默认Servlet生效，该Servlet将对静态资源放行
    @Override
    public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
        configurer.enable();
    }
}
